<?php 
 //初始化路径
 init();

 function init()	{
 	rootpath();
 }
 /**
 *	定义__ROOT__路径
 */
 function rootpath()	{
    if(!defined('_PHP_FILE_')) {
        $_temp  = explode('.php',$_SERVER['PHP_SELF']);
        define('_PHP_FILE_',    rtrim(str_replace($_SERVER['HTTP_HOST'],'',$_temp[0].'.php'),'/'));
    }
    if(!defined('__ROOT__')) {
        $_root  =   rtrim(dirname(_PHP_FILE_),'/');
        define('__ROOT__',  (($_root=='/' || $_root=='\\')?'':$_root));
    }
 }

function is_mobile()	{
	if (preg_match('/iP(hone|ad)|Android|Blackberry|Symbian|windows (ce|phone)/i',
					$_SERVER ['HTTP_USER_AGENT'] ))	{
		header ("Location: ./wap.php");
	}
}